package com.njtech.pet.constant;

import java.util.Date;

/**
 * @author lxj
 * Date:2020-03-09 10:55
 * Description:常量类
 */
public class Constant {

    /**
     * 行为的常量类
     */
    public static enum Action{

        /**
         *
         */
        ACTION_VIEW(0,"浏览"),
        ACTION_COLLECT(1,"收藏"),
        ACTION_BUY(2,"购买"),
        ACTION_SEARCH(3,"搜索"),
        ACTION_SIGN(4,"每日首签"),
        ACTION_SHARE(5,"每日首分享"),
        STATE_VALID(0,"有效"),
        STATE_INVALID(1,"无效");

        private Action(Integer key,String value){
            this.key = key;
            this.value = value;
        }
        private final Integer key;
        private final String value;

        public Integer getKey() {
            return key;
        }

        public String getValue() {
            return value;
        }

    }

    /**
     *
     */
    public static enum Bill{
        /**
         *
         */
        TYPE_INSURANCE(0,"商品结算"),
        TYPE_COUPON(1,"领取优惠券"),
        TYPE_EDIT(2,"管理员修改"),
        TYPE_SIGN(3,"签到活动"),
        TYPE_SHARE(4,"分享链接奖励"),
        TYPE_TOPUPMEMBER(5,"充值会员"),

        STATE_BILL_UNPAID(5,"订单未支付"),
        STATE_BILL_PAID(6,"订单已支付"),
        STATE_BILL_USED(7,"订单已使用"),
        STATE_BILL_EXPIRED(8,"订单已过期"),
        STATE_COUPON_UNUSED(9,"优惠券未使用"),
        STATE_COUPON_USED(10,"优惠券已使用"),
        STATE_COUPON_EXPIRED(11,"优惠券已过期"),
        STATE_BILL_REFUND(12,"订单已退款"),
        STATE_PERMANENT(13,"永久有效"),
        STATE_BILL_DELETE(14,"订单已取消"),
        TYPE_USE_COUPON(15,"使用优惠券"),
        TYPE_FIRST_SIGN_IN(16,"每日首签"),
        TYPE_ADD(17,"管理员添加"),
        TYPE_DELETE(18,"管理员删除")
        ;
        private final Integer key;
        private final String value;

        Bill(Integer key, String value) {
            this.key = key;
            this.value = value;
        }

        public Integer getKey() {
            return key;
        }

        public String getValue() {
            return value;
        }
    }

    /**
     *
     */
    public static enum Friend{
        /**
         *
         */
        STATE_SENT(0, "已发送"),
        STATE_REJECTED(1, "已拒绝"),
        STATE_ACCEPTED(2, "已同意"),
        STATE_DELETED(3, "已删除"),
        STATE_REJECTED_UNREAD(4,"已拒绝*"),
        STATE_CUSTOMER_SERVICE(5,"绑定客服"),
        ;
        private final Integer key;
        private final String value;

        Friend(Integer key, String value) {
            this.key = key;
            this.value = value;
        }

        public Integer getKey() {
            return key;
        }

        public String getValue() {
            return value;
        }
    }

    /**
     *
     */
    public static enum Item{
        /**
         *
         */
        TYPE_INSURANCE(0, "保险"),
        TYPE_COUPON(1, "优惠券"),
        TYPE_COMMODITY(2, "商品"),
        TYPE_MONTHYMEMBER(3,"月度VIP"),
        TYPE_SIGN_IN(4,"每日签到"),

        STATE_VALID(3, "有效"),
        STATE_PERMANENT(5,"永久有效"),
        STATE_EXPIRED(4, "已下架"),
        ;
        private final Integer key;
        private final String value;

        Item(Integer key, String value) {
            this.key = key;
            this.value = value;
        }

        public Integer getKey() {
            return key;
        }

        public String getValue() {
            return value;
        }
    }

    /**
     *
     */
    public static enum Message{

        /**
         *
         */
        STATE_READ(0,"已读"),
        STATE_UNREAD(0,"未读"),
        STATE_WITHDRAWN(0,"已撤回"),

        TYPE_CHAT(0,"聊天"),
        TYPE_CONSOLE(0,"咨询"),
        TYPE_COMPLAIN(0,"售后"),
        ;
        private final Integer key;
        private final String value;

        Message(Integer key, String value) {
            this.key = key;
            this.value = value;
        }

        public Integer getKey() {
            return key;
        }

        public String getValue() {
            return value;
        }
    }

    /**
     *
     */
    public static enum Person{

        /**
         *
         */
        STATE_VALID(0, "有效"),
        STATE_INVALID(1, "无效"),
        ;
        private final Integer key;
        private final String value;

        Person(Integer key, String value) {
            this.key = key;
            this.value = value;
        }

        public Integer getKey() {
            return key;
        }

        public String getValue() {
            return value;
        }
    }

    /**
     *
     */
    public static enum Pet{
        /**
         *
         */
        STATE_VALID(0, "有效"),
        STATE_INVALID(1, "无效"),
        ;
        private final Integer key;
        private final String value;

        Pet(Integer key, String value) {
            this.key = key;
            this.value = value;
        }

        public Integer getKey() {
            return key;
        }

        public String getValue() {
            return value;
        }
    }

    /**
     *
     */
    public static enum Power{
        /**
         *
         */
        STATE_VALID(0, "有效"),
        STATE_INVALID(1, "无效"),
        POWER_USER(1,"用户管理员"),
        POWER_ITEM(2,"商品管理员"),
        POWER_BILL(3,"订单管理员"),
        POWER_MEMBER(4,"会员管理员"),
        POWER_POWER(5,"权限分配管理员"),
        POWER_SYSTEM(6,"系统管理员"),
        ;
        private final Integer key;
        private final String value;

        Power(Integer key, String value) {
            this.key = key;
            this.value = value;
        }

        public Integer getKey() {
            return key;
        }

        public String getValue() {
            return value;
        }
    }

    /**
     *
     */
    public static enum User{
        /**
         *
         */
        STATE_VALID(0, "有效"),
        STATE_INVALID(1, "无效"),

        SEX_MALE(2, "男性"),
        SEX_FEMALE(3, "女性"),
        STATE_FREEZE(4,"冻结"),
        ROLE_VISITOR(5,"游客"),
        ROLE_USER(6,"普通用户"),
        ROlE_MEMBER(7,"会员"),
        ROLE_ADMIN(8,"管理员"),
        ROLE_SERVICE(9,"客服"),

        PWD_DEFAULT(10,"123456"),
        ;
        private final Integer key;
        private final String value;

        User(Integer key, String value) {
            this.key = key;
            this.value = value;
        }

        public Integer getKey() {
            return key;
        }

        public String getValue() {
            return value;
        }
    }

    /**
     * 用户的会员相关常量属性
     */
    public static enum Member{
        /**
         *等级、等级名、下限、上限、折扣系数、积分系数
         */
        LEVEL0(0, "普通用户", 0, 10000, 1.0, 1.0),

        LEVEL1(1, "VIP1", 0, 50, 0.95, 1.1),

        LEVEL2(2, "VIP2", 51, 200, 0.9, 1.2),

        LEVEL3(3, "VIP3", 201, 400, 0.85, 1.3),

        LEVEL4(4, "VIP4", 401, 800, 0.8, 1.4),

        LEVEL5(5, "VIP5", 801, 10000, 0.7, 1.6),

        ;

        //普通的key value属性
        private final Integer key;
        private final String value;

        /**
         * 积分下限和上限
         */
        private final Integer lower;
        private final Integer upper;

        /**
         *等级对应的特权
         */
        private final Double discount;
        private final Double creditPercent;

        Member(Integer key, String value, Integer lower, Integer upper, Double discount, Double creditPercent) {
            this.key = key;
            this.value = value;
            this.lower = lower;
            this.upper = upper;
            this.discount = discount;
            this.creditPercent = creditPercent;
        }

        public Integer getKey() {
            return key;
        }

        public String getValue() {
            return value;
        }

        public Integer getLower() {
            return lower;
        }

        public Integer getUpper() {
            return upper;
        }

        public Double getDiscount() {
            return discount;
        }

        public Double getCreditPercent() {
            return creditPercent;
        }

    }

    /**
     *积分常量
     */
    public static enum Credit{
        /**
         * 每日签到所获的基础积分
         * value存储基础积分
         */
        DAILY_CREDIT(0, 20),
        //分享产生基础积分
        SHARE_CREDIT(1,5),
        ;
        private final Integer key;
        private final Integer value;

        Credit(Integer key, Integer value){
            this.key = key;
            this.value = value;
        }

        public Integer getKey() {
            return key;
        }

        public Integer getValue() {
            return value;
        }

    }

    /**
     * 定义月度会员所抽象成的商品
     * 用于当充值会员生成bill时所对应的item
     */
    public static final com.njtech.pet.entity.Item memberItem = new com.njtech.pet.entity.Item(000,new Date(),"月度VIP",Item.TYPE_MONTHYMEMBER.getValue(),"无","无","当场生效",31,20.0,20,"系统自动识别", Item.STATE_PERMANENT.getValue(),new Date(),"进行开通或续费会员","/");


    /**
     * 定义每日签到所抽象成的商品
     * 用于每日签到生成bill时对应的item
     */
    public static final com.njtech.pet.entity.Item signInItem = new com.njtech.pet.entity.Item(100,new Date(),"每日签到",Item.TYPE_SIGN_IN.getValue(),"无","无","当场生效",1,0.0,20,"系统自动识别", Item.STATE_PERMANENT.getValue(),new Date(),"进行每日签到","/");
}